﻿using System;
using System.Text;
using System.Data;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ysb.Components;
using BLL;
using DAL;
using Model;
public partial class Admin_Zhuizong : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!Page.IsPostBack)
        {
            Header.Title = ApplicationInfo.ApplicationName + "单据追踪";
            if (Request.QueryString["id"] != null)
            {

                DataLoad();


            }
            else
            {

            }

        }
    }

    private void DataLoad()
    {
        // DataSet ds = new WayBillService().getsearch10(Request.QueryString["id"].ToString());
        List<TnoInfo> list = new WayBillService().GetZhuizhong(Request.QueryString["id"].ToString());
        if (list.Count > 0)
        {
            rplist.DataSource = list;
            rplist.DataBind();
        }
        else
        {

     //  Tools.OpenWindow(this, "当前查询并无数据！");
        }


    }

    public string GetState(string tno)
    {
        return new WayBillService().GetBillState(tno);






    }
    protected void okbtn_Click(object sender, ImageClickEventArgs e)
    {
        if (billlist.Value.Trim() != "")
        {
            string stxt = StrHelper.StringToHtml(billlist.Value.Trim());

            stxt = stxt.Replace("<br>", ",");



            string ss = billlist.Rows.ToString();



            string[] stringSeparators = new string[] { "," };

            string[] arrey = stxt.Split(stringSeparators, StringSplitOptions.None);


            if (stxt.Substring(0, 1) == "1")
            {
              stxt = "yj" + stxt + "up";
            }

            if (arrey.Length > 10)
            {
                //判断 数组里是否小于或等于10 个长度

                Tools.OpenWindow(this, "最多只能输入10行数据！");

                return;
            }


            if (stxt.Length > 130)
            {
                // 按照如果都是13位长度来判断 是否小于10 单号

                Tools.OpenWindow(this, "最多只能输入10个单号！");
                return;
            }
            else
            {

                Response.Redirect("Zhuizong.aspx?id=" + stxt);
            }

            //}
        }
        else
        {
            Tools.OpenWindow(this, "请输入单号");

            return;
        }
    }
}
